#include "tool.h"

using namespace alice;

std::string Tool::CurrentPath() {
  char buffer[100];
  getcwd(buffer, sizeof(buffer));
  std::string current_path = buffer;
    
  // 将所有 '\' 字符替换为 '/' 字符
  // ASCII: { 92: \ }, { 47: / }
  char old_char = 92, new_char = 47;
  std::string goal(1, new_char);
  int pos = current_path.find(old_char);
  while (pos != current_path.npos) {
    current_path.replace(pos, 1, goal);
    pos = current_path.find(old_char);
  }
  
  return current_path;
}